<?php
/**
 * Created by PhpStorm.
 * User: HuangLuSen
 * Date: 2017/5/5
 * Time: 15:29
 */

namespace app\admin\model;

use think\Model;

class Source extends Model
{
    protected $autoWriteTimestamp = 'int';

    /**
     * 状态获取器
     * @param $value
     * @param $data
     * @return mixed
     */
    public function getStatusTextAttr($value, $data)
    {
        $status = [1 => '<span class="label label-success">启用</span>', 0 => '<span class="label label-danger">禁用'];
        return $status[$data['status']];
    }
}